package com.partyjoin.project.module.politicalExamine.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.partyjoin.common.utils.StringUtils;
import com.partyjoin.project.module.politicalExamine.mapper.PoliticalExamineMapper;
import com.partyjoin.project.module.politicalExamine.domain.PoliticalExamine;
import com.partyjoin.project.module.politicalExamine.service.IPoliticalExamineService;
import com.partyjoin.common.support.Convert;

/**
 * 政审记录 服务层实现
 * 
 * @author 莫东林
 * @date 2018-07-19
 */
@Service
public class PoliticalExamineServiceImpl implements IPoliticalExamineService 
{
	@Autowired
	private PoliticalExamineMapper politicalExamineMapper;

	/**
     * 查询政审记录信息
     * 
     * @param examineId 政审记录ID
     * @return 政审记录信息
     */
    @Override
	public PoliticalExamine selectPoliticalExamineById(Integer examineId)
	{
	    return politicalExamineMapper.selectPoliticalExamineById(examineId);
	}
	
	/**
     * 查询政审记录列表
     * 
     * @param politicalExamine 政审记录信息
     * @return 政审记录集合
     */
	@Override
	public List<PoliticalExamine> selectPoliticalExamineList(PoliticalExamine politicalExamine)
	{
	    return politicalExamineMapper.selectPoliticalExamineList(politicalExamine);
	}
	
    /**
     * 新增政审记录
     * 
     * @param politicalExamine 政审记录信息
     * @return 结果
     */
	@Override
	public int insertPoliticalExamine(PoliticalExamine politicalExamine)
	{
	    return politicalExamineMapper.insertPoliticalExamine(politicalExamine);
	}
	
	/**
     * 修改政审记录
     * 
     * @param politicalExamine 政审记录信息
     * @return 结果
     */
	@Override
	public int updatePoliticalExamine(PoliticalExamine politicalExamine)
	{
	    return politicalExamineMapper.updatePoliticalExamine(politicalExamine);
	}
	
	/**
     * 保存政审记录
     * 
     * @param politicalExamine 政审记录信息
     * @return 结果
     */
	@Override
	public int savePoliticalExamine(PoliticalExamine politicalExamine)
	{
	    Integer examineId = politicalExamine.getExamineId();
		int rows = 0;
		if (StringUtils.isNotNull(examineId))
        {
		    rows = politicalExamineMapper.updatePoliticalExamine(politicalExamine);
		}
		else
        {
		    rows = politicalExamineMapper.insertPoliticalExamine(politicalExamine);
		}
		return rows;
	}
	
	/**
     * 删除政审记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deletePoliticalExamineByIds(String ids)
	{
		return politicalExamineMapper.deletePoliticalExamineByIds(Convert.toStrArray(ids));
	}

	/**
	 * 通过用户Id查询政审记录
	 */
	@Override
	public PoliticalExamine selectPoliticalExamineByUserId(Long userId) {
		return politicalExamineMapper.selectPoliticalExamineByUserId(userId);
	}
	
}
